package top.huhuiyu.springboot.study.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @author 胡辉煜
 */
@Aspect
@Component
@Slf4j
@Order(200)
public class AroundAop implements BaseControllerAop {

  @Around("pointcut()")
  public Object around(ProceedingJoinPoint pjp) throws Throwable {
    log.debug("环绕切面的前置");
    // 执行被切面拦截方法并获取返回值
    Object result = pjp.proceed();
    log.debug("环绕切面的返回值：{}", result);
    log.debug("环绕切面的尾置");
    return result;
  }

}
